package com.Ajava1704.for并发包下的类.ForCountDownLatch;

import java.util.concurrent.CountDownLatch;

/**
 * @类名: com.Ajava1704.for并发包下的类.ForCountDownLatch
 * @作者: lgt
 * @创建时间: 2020-02-11 20:36
 * @描述:
 **/
public class ForBingFaBao1 {

    public static void main(String[] args) throws InterruptedException {
        CountDownLatch countDownLatch=new CountDownLatch(2);

        Thread thread=new Thread(new ForCountRunable(countDownLatch,2),"A");
        thread.start();

        Thread thread2=new Thread(new ForCountRunable(countDownLatch,5),"B");
        thread2.start();

        countDownLatch.await();//阻塞主线程

        CountDownLatch countDownLatch2=new CountDownLatch(2);
        Thread thread3=new Thread(new ForCountRunable(countDownLatch2,2),"A");
        thread3.start();

        countDownLatch2.await();//阻塞主线程

        System.out.println("=====都到了，开始出发去旅游了=====");
    }
}
